clear
clear
cd "E:\"

log using ReplicationResults.log,replace
***************************************************************************************
*          "Racial and Partisan Social Information Prompts Campaign Giving"           *
*               Karen H. Cyphers        Hans J.G. Hassell        Kai Ou               *
*                                                                                     *
*  Note: All commands are compiled in this one Do file (based on STATA Version 18)    *
*  The file FloridaDonation.dta contains the de-identified data of our experiment     *
*  The file PretestSurvey.dta contains the de-identified data of our pre-survey       * 
*  The file FloridaDonation-POBE-ReplicationCode.do contains the Stata codes used     *
*      to perform statistical analysis.                                               * 
*  The analysis is organized by the sequence of results in the manuscript.            *
***************************************************************************************
*               Variable names and their meanings are reported below:                 *
*                                                                                     *
*  PARTY: Individuals' party affiliations, if any.                                    *
*  Women: 1 or 0                                                                      *
*  White: Whether the individual's race is White                                      *
*  EthnicMinorities: Whether the individual's race is either Black or Hispanic/Latinos*
*  AGE: There are three age groups. 18-34; 35-54; 55+                                 *
*  POLITICALACTIVITIESINPAST2Y: Self-reported political activities in past 2 years    *
*  Treatment: Which treatment individuals were randomly assigned to.                  *
*  UniqueDonorID: The unique identification of donors in our data set.                *
*  PreTreatmentFreq: How many times that an individual contributed pretreatment.      *
*  PreTreatmentAmount: The total amount that an individual contributed pretreatment   *
*  PostTreatmentFreqbyW1Nov: How many times that an individual contributed between    *
*         16 October 2020 and 5 November 2020, which is 3 weeks after interventions   *
*  PostTreatmentAmountbyW1Nov: The total amount of money that an individual           *
*         contributed between 16 October 2020 and 5 November 2020                     *
*  PostTreatmentFreqbyXmas: How many times that an individual contributed             *
*         between 16 October 2020 and 24 December 2020                                *
*  PostTreatmentAmountbyXmas: The total amount of money that an individual            *  
*         contributed between 16 October 2020 and 24 December 2020                    *
***************************************************************************************

use FloridaDonation.dta,replace




tab Treatment

gen PartisanVSControl=0 if Treatment=="Control"
replace PartisanVSControl=1 if Treatment=="Partisan"

gen RaceVSControl=0 if Treatment=="Control"
replace RaceVSControl=1 if Treatment=="Race"

gen PreviousDonor=0 if PreTreatmentFreq==0
replace PreviousDonor=1 if PreTreatmentFreq>0

***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
//Examine Pretreatment giving propensity across treatments//
ttest PreviousDonor,by(PartisanVSControl)
ranksum PreviousDonor,by(PartisanVSControl)

ttest PreviousDonor,by(RaceVSControl)
ranksum PreviousDonor,by(RaceVSControl)

//Summarize Pretreatment giving frequency//
summarize PreTreatmentFreq if PreviousDonor==1&Treatment=="Control",detail
summarize PreTreatmentFreq if PreviousDonor==1&Treatment=="Partisan",detail
summarize PreTreatmentFreq if PreviousDonor==1&Treatment=="Race",detail

//Summarize Pretreatment giving amount//
summarize PreTreatmentAmount if PreviousDonor==1&Treatment=="Control",detail
summarize PreTreatmentAmount if PreviousDonor==1&Treatment=="Partisan",detail
summarize PreTreatmentAmount if PreviousDonor==1&Treatment=="Race",detail


//Examine Pretreatment differences of giving frequency and amount//
median PreTreatmentFreq if PreviousDonor==1,by(PartisanVSControl)
median PreTreatmentFreq if PreviousDonor==1,by(RaceVSControl)

median PreTreatmentAmount if PreviousDonor==1,by(PartisanVSControl)
median PreTreatmentAmount if PreviousDonor==1,by(RaceVSControl)
***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
*    Differential effects of partisan and racial descriptive normative information    *
***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
//How many donations are observed in the first three weeks?
tab PostTreatmentFreqbyW1Nov if PostTreatmentFreqbyW1Nov>0
//How many donations are observed in the 10 weeks?
tab PostTreatmentFreqbyXmas if PostTreatmentFreqbyXmas>0

//How many donations occurred within three weeks by treatment//
tab Treatment if PostTreatmentFreqbyW1Nov>0

//Posttreatment donation propensity difference among all donors//
gen PostTreatmentDonationbyW1Nov=0 if PostTreatmentFreqbyW1Nov==0
replace PostTreatmentDonationbyW1Nov=1 if PostTreatmentFreqbyW1Nov>0

gen PostTreatmentDonationbyXmas=0 if PostTreatmentFreqbyXmas==0
replace PostTreatmentDonationbyXmas=1 if PostTreatmentFreqbyXmas>0

********************************************************************************
*Individuals with no party affiliation were excluded from the analysis*
ttest PostTreatmentDonationbyW1Nov if PARTY!="NPA",by(PartisanVSControl)
prtest PostTreatmentDonationbyW1Nov if PARTY!="NPA",by(PartisanVSControl)
tab PostTreatmentDonationbyW1Nov PartisanVSControl if PARTY!="NPA",chi2
********************************************************************************
ttest PostTreatmentDonationbyW1Nov,by(RaceVSControl)
prtest PostTreatmentDonationbyW1Nov,by(RaceVSControl)
********************************************************************************
*Whose Giving Contributed to the Aforementioned Observations? Previous Donors*
tab PostTreatmentDonationbyW1Nov PreviousDonor
tab PostTreatmentDonationbyXmas PreviousDonor
ttest PostTreatmentDonationbyW1Nov,by(PreviousDonor)
prtest PostTreatmentDonationbyW1Nov,by(PreviousDonor)
********************************************************************************
********************************************************************************
//Partisan vs Control//
//Posttreatment donation propensity difference among previous donors, within three weeks//
ttest PostTreatmentDonationbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
prtest PostTreatmentDonationbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
ranksum PostTreatmentDonationbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
tab PostTreatmentDonationbyW1Nov PartisanVSControl if PreviousDonor==1&PARTY!="NPA", chi2

//Posttreatment donation frequency difference among previous donors, within three weeks//
tab PostTreatmentFreqbyW1Nov PartisanVSControl if PreviousDonor==1&PARTY!="NPA"
ranksum PostTreatmentFreqbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
median PostTreatmentFreqbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)

//Posttreatment donation amount difference among previous donors, within three weeks//
tab PostTreatmentAmountbyW1Nov PartisanVSControl if PreviousDonor==1&PARTY!="NPA"
ranksum PostTreatmentAmountbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
median PostTreatmentAmountbyW1Nov if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
********************************************************************************
********************************************************************************
//Race vs Control//
//Posttreatment donation propensity difference among previous donors, within three weeks//
ttest PostTreatmentDonationbyW1Nov if PreviousDonor==1,by(RaceVSControl)
prtest PostTreatmentDonationbyW1Nov if PreviousDonor==1,by(RaceVSControl)
ranksum PostTreatmentDonationbyW1Nov if PreviousDonor==1,by(RaceVSControl)
tab PostTreatmentDonationbyW1Nov RaceVSControl if PreviousDonor==1, chi2

//Posttreatment donation frequency difference among previous donors, within three weeks//
tab PostTreatmentFreqbyW1Nov RaceVSControl if PreviousDonor==1
ranksum PostTreatmentFreqbyW1Nov if PreviousDonor==1,by(RaceVSControl)
median PostTreatmentFreqbyW1Nov if PreviousDonor==1,by(RaceVSControl)

//Posttreatment donation amount difference among previous donors, within three weeks//
tab PostTreatmentAmountbyW1Nov RaceVSControl if PreviousDonor==1
ranksum PostTreatmentAmountbyW1Nov if PreviousDonor==1,by(RaceVSControl)
median PostTreatmentAmountbyW1Nov if PreviousDonor==1,by(RaceVSControl)
***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
*              Differential treatment effects on minorities and whites                *
***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
//EthnicMinorities, three weeks//
ttest PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)
permtest2 PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)

ttest PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
permtest2 PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
//EthnicMinorities, ten weeks//
ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)

ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
********************************************************************************
********************************************************************************
********************************************************************************
********************************************************************************
//White donors, three weeks//
ttest PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)

ttest PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)
permtest2 PostTreatmentDonationbyW1Nov if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)

//White donors, ten weeks//
ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)
ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)

***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
*                        Donation history and treatment effects                       *
***************************************************************************************
***************************************************************************************
***************************************************************************************
***************************************************************************************
ttest PostTreatmentDonationbyW1Nov, by(PreviousDonor)
tab PostTreatmentDonationbyW1Nov PreviousDonor,chi2

ttest PostTreatmentDonationbyXmas, by(PreviousDonor)
tab PostTreatmentDonationbyXmas PreviousDonor,chi2


ttest PostTreatmentDonationbyW1Nov=0 if PreviousDonor==1
ttest PostTreatmentDonationbyW1Nov=0 if PreviousDonor==0


ttest PostTreatmentDonationbyW1Nov if Treatment=="Control",by(PreviousDonor)
tab PostTreatmentDonationbyW1Nov PreviousDonor if Treatment=="Control",chi2

ttest PostTreatmentDonationbyW1Nov if Treatment=="Race",by(PreviousDonor)
tab PostTreatmentDonationbyW1Nov PreviousDonor if Treatment=="Race",chi2

ttest PostTreatmentDonationbyW1Nov if Treatment=="Partisan",by(PreviousDonor)
tab PostTreatmentDonationbyW1Nov PreviousDonor if Treatment=="Partisan",chi2




////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////   Appendix   /////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
///Table A1: Summary Statistics of Registered Voters' Demographic Background////
////////////////////////////////////////////////////////////////////////////////


gen AgeGroupYong=0
replace AgeGroupYong=1 if AGE=="18-34"
gen AgeGroupMiddle=0
replace AgeGroupMiddle=1 if AGE=="35-54"
gen AgeGroupOld=0
replace AgeGroupOld=1 if AGE=="55+"

gen PropDem=0 if PARTY!="NPA"
replace PropDem=1 if PARTY=="DEM"


tabstat Women PropDem AgeGroupYong AgeGroupMiddle AgeGroupOld EthnicMinorities PreviousDonor,by(Treatment) stat(mean semean) nototal format(%9.3f) 
tabstat Women PropDem AgeGroupYong AgeGroupMiddle AgeGroupOld PreviousDonor if EthnicMinorities==0,by(Treatment) stat(mean semean) nototal format(%9.3f)
tabstat Women PropDem AgeGroupYong AgeGroupMiddle AgeGroupOld PreviousDonor if EthnicMinorities==1,by(Treatment) stat(mean semean) nototal format(%9.3f)


split POLITICALACTIVITIESINPAST2Y , parse(;) generate(PoliticalActivities)
gen PoliticalActivities2Y=0
replace PoliticalActivities2Y=PoliticalActivities2Y+1 if PoliticalActivities1!=""
replace PoliticalActivities2Y=PoliticalActivities2Y+1 if PoliticalActivities1!="I have done none of these"&PoliticalActivities2!=""
replace PoliticalActivities2Y=PoliticalActivities2Y+1 if PoliticalActivities1!="I have done none of these"&PoliticalActivities2!=""&PoliticalActivities3!=""
replace PoliticalActivities2Y=PoliticalActivities2Y+1 if PoliticalActivities1!="I have done none of these"&PoliticalActivities2!=""&PoliticalActivities3!=""&PoliticalActivities4!=""
replace PoliticalActivities2Y=PoliticalActivities2Y+1 if PoliticalActivities1!="I have done none of these"&PoliticalActivities2!=""&PoliticalActivities3!=""&PoliticalActivities4!=""&PoliticalActivities5!=""
replace PoliticalActivities2Y=PoliticalActivities2Y+1 if PoliticalActivities1!="I have done none of these"&PoliticalActivities2!=""&PoliticalActivities3!=""&PoliticalActivities4!=""&PoliticalActivities5!=""&PoliticalActivities6!=""

ttest PoliticalActivities2Y if PARTY!="NPA"&PoliticalActivities2Y!=0,by(PartisanVSControl)
ttest PoliticalActivities2Y if PoliticalActivities2Y!=0,by(RaceVSControl)

ttest PoliticalActivities2Y if PARTY!="NPA"&PoliticalActivities2Y!=0& White==1,by(PartisanVSControl)
ttest PoliticalActivities2Y if PoliticalActivities2Y!=0& White==1,by(RaceVSControl)

ttest PoliticalActivities2Y if PARTY!="NPA"&PoliticalActivities2Y!=0& White==1,by(PartisanVSControl)
ttest PoliticalActivities2Y if PoliticalActivities2Y!=0& White==1,by(RaceVSControl)

ttest PoliticalActivities2Y if PARTY!="NPA"&PoliticalActivities2Y!=0& White==0,by(PartisanVSControl)
ttest PoliticalActivities2Y if PoliticalActivities2Y!=0& White==0,by(RaceVSControl)

ttest PoliticalActivities2Y if PARTY!="NPA"&PoliticalActivities2Y!=0& White==0,by(PartisanVSControl)
ttest PoliticalActivities2Y if PoliticalActivities2Y!=0& White==0,by(RaceVSControl)

tabstat PreTreatmentFreq PreTreatmentAmount if PreviousDonor==1,by(Treatment) stat(median) nototal format(%9.3f) 
tabstat PreTreatmentFreq PreTreatmentAmount if PreviousDonor==1&EthnicMinorities==0,by(Treatment) stat(median) nototal format(%9.3f) 
tabstat PreTreatmentFreq PreTreatmentAmount if PreviousDonor==1&EthnicMinorities==1,by(Treatment) stat(median) nototal format(%9.3f) 

////////////////////////////////////////////////////////////////////////////////
///Table A2: The Demographic Characteristics of Treatments and Florida Voters///
////////////////////////////////////////////////////////////////////////////////
gen NPA=0
replace NPA=1 if PARTY=="NPA"

gen DEMParty=0
replace DEMParty=1 if PARTY=="DEM"
gen REPParty=0
replace REPParty=1 if PARTY=="REP"
tabstat Women White EthnicMinorities NPA DEMParty REPParty AgeGroupYong AgeGroupMiddle AgeGroupOld,by(Treatment) stat(mean) nototal format(%9.4f) 


////////////////////////////////////////////////////////////////////////////////
/////////////                   Appendix A3 Results                /////////////
////////////////////////////////////////////////////////////////////////////////

preserve
clear
use PretestSurvey,replace
kdensity DonationFrequency, name(FigureA1,replace) xlabel(,nogrid) ylabel(,nogrid) graphregion(color(white))/* 
*/plotregion(color(white)) title("Kernel Density Distribution",color(black))/* 
*/xtitle("Frequency of Donation in the Recent Election Cycle",color(black))


kdensity DonationAmount, name(FigureA2,replace) xlabel(,nogrid) ylabel(,nogrid) graphregion(color(white))/* 
*/plotregion(color(white)) title("Kernel Density Distribution",color(black))/* 
*/xtitle("Amount of Donation in the Recent Election Cycle",color(black))

tab DonationAmount

////////////////////////////////////////////////////////////////////////////////
///       Table A3: Average Donation Behavior by Racial Group and Party      ///
////////////////////////////////////////////////////////////////////////////////
summarize DonationFrequency if RaceEthnicity =="Black"
summarize DonationFrequency if RaceEthnicity =="Hispanic"
summarize DonationFrequency if RaceEthnicity =="White, Not Hispanic"
summarize DonationFrequency if Party=="DEM"
summarize DonationFrequency if Party=="REP"


summarize DonationAmount if RaceEthnicity =="Black"&DonationAmount<=200
summarize DonationAmount if RaceEthnicity =="Hispanic"&DonationAmount<=200
summarize DonationAmount if RaceEthnicity =="White, Not Hispanic"&DonationAmount<=200
summarize DonationAmount if Party=="DEM"&DonationAmount<=200
summarize DonationAmount if Party=="REP"&DonationAmount<=200


summarize DonationAmount if RaceEthnicity =="Black"&DonationAmount<=400
summarize DonationAmount if RaceEthnicity =="Hispanic"&DonationAmount<=400
summarize DonationAmount if RaceEthnicity =="White, Not Hispanic"&DonationAmount<=400
summarize DonationAmount if Party=="DEM"&DonationAmount<=400
summarize DonationAmount if Party=="REP"&DonationAmount<=400

summarize DonationAmount if RaceEthnicity =="Black"
summarize DonationAmount if RaceEthnicity =="Hispanic"
summarize DonationAmount if RaceEthnicity =="White, Not Hispanic"
summarize DonationAmount if Party=="DEM"
summarize DonationAmount if Party=="REP"
restore


////////////////////////////////////////////////////////////////////////////////
/////////////                   Appendix B1 Results                /////////////
////////////////////////////////////////////////////////////////////////////////


//Partisan vs Control//
//Posttreatment donation propensity difference among previous donors, within 10 weeks//
ttest PostTreatmentDonationbyXmas if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
prtest PostTreatmentDonationbyXmas if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
ranksum PostTreatmentDonationbyXmas if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
tab PostTreatmentDonationbyXmas PartisanVSControl if PreviousDonor==1&PARTY!="NPA", chi2
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1&PARTY!="NPA",by(PartisanVSControl)
********************************************************************************
********************************************************************************
//Race vs Control//
//Posttreatment donation propensity difference among previous donors, within 10 weeks//
ttest PostTreatmentDonationbyXmas if PreviousDonor==1,by(RaceVSControl)
prtest PostTreatmentDonationbyXmas if PreviousDonor==1,by(RaceVSControl)
ranksum PostTreatmentDonationbyXmas if PreviousDonor==1,by(RaceVSControl)
tab PostTreatmentDonationbyXmas RaceVSControl if PreviousDonor==1, chi2
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1,by(RaceVSControl)


//EthnicMinorities vs White//
ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
ranksum PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
display normal(`r(z)')
tab PostTreatmentDonationbyXmas PartisanVSControl if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA", chi2
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)

ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)
ranksum PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)
display normal(`r(z)')
tab PostTreatmentDonationbyXmas RaceVSControl if PreviousDonor==1&EthnicMinorities==1, chi2
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)


ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)
ranksum PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)
display normal(`r(z)')
tab PostTreatmentDonationbyXmas PartisanVSControl if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA", chi2
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)

ttest PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)
ranksum PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)
display normal(`r(z)')
tab PostTreatmentDonationbyXmas RaceVSControl if PreviousDonor==1&EthnicMinorities==0, chi2
permtest2 PostTreatmentDonationbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)


//Posttreatment donation frequency difference among previous minorities donors, within 10 weeks//
tab PostTreatmentFreqbyXmas RaceVSControl if PreviousDonor==1&EthnicMinorities==1
ranksum PostTreatmentFreqbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)
median PostTreatmentFreqbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)

tab PostTreatmentFreqbyXmas PartisanVSControl if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA"
ranksum PostTreatmentFreqbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
median PostTreatmentFreqbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)

//Posttreatment donation amount difference among previous minorities donors, within 10 weeks//
tab PostTreatmentAmountbyXmas RaceVSControl if PreviousDonor==1&EthnicMinorities==1
ranksum PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)
median PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==1,by(RaceVSControl)

tab PostTreatmentAmountbyXmas PartisanVSControl if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA"
ranksum PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)
median PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==1&PARTY!="NPA",by(PartisanVSControl)


//Posttreatment donation frequency difference among previous white donors, within 10 weeks//
tab PostTreatmentFreqbyXmas RaceVSControl if PreviousDonor==1&EthnicMinorities==0
ranksum PostTreatmentFreqbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)
median PostTreatmentFreqbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)

tab PostTreatmentFreqbyW1Nov PartisanVSControl if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA"
ranksum PostTreatmentFreqbyW1Nov if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)
median PostTreatmentFreqbyW1Nov if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)

//Posttreatment donation amount difference among previous white donors, within 10 weeks//
tab PostTreatmentAmountbyXmas RaceVSControl if PreviousDonor==1&EthnicMinorities==0
ranksum PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)
median PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==0,by(RaceVSControl)

tab PostTreatmentAmountbyXmas PartisanVSControl if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA"
ranksum PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)
median PostTreatmentAmountbyXmas if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",by(PartisanVSControl)


////////////////////////////////////////////////////////////////////////////////
/////////////                   Appendix B2 Results                /////////////
////////////////////////////////////////////////////////////////////////////////
preserve
gen PartisanIdentity=0
replace PartisanIdentity=1 if Treatment=="Partisan"
gen RacialIdentity=0
replace RacialIdentity=1 if Treatment=="Race"

//Column 1
reg PostTreatmentDonationbyW1Nov  PartisanIdentity RacialIdentity Women AgeGroupYong AgeGroupMiddle if PreviousDonor==1&PARTY!="NPA",robust

//Column 2
reg PostTreatmentDonationbyW1Nov  PartisanIdentity RacialIdentity EthnicMinorities Women AgeGroupYong AgeGroupMiddle if PreviousDonor==1&PARTY!="NPA",robust

//Column 3
reg PostTreatmentDonationbyW1Nov  PartisanIdentity RacialIdentity EthnicMinorities PartisanIdentity##EthnicMinorities  RacialIdentity##EthnicMinorities Women AgeGroupYong AgeGroupMiddle if PreviousDonor==1&PARTY!="NPA",robust
restore

////////////////////////////////////////////////////////////////////////////////
///   Table A5: Donation by Treatment and Time Window(Linear Prob Models)    ///
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
preserve
//Column 1
reg PostTreatmentDonationbyW1Nov  PartisanVSControl Women AgeGroupYong AgeGroupMiddle if PreviousDonor==1&PARTY!="NPA"&EthnicMinorities==1,robust
outreg2 using TableA5.doc, replace ctitle(1) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, Minorities, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 2
reg PostTreatmentDonationbyW1Nov  PartisanVSControl  Women AgeGroupYong  AgeGroupMiddle  if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",robust
outreg2 using TableA5.doc, append ctitle(2) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, White, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 3
reg PostTreatmentDonationbyW1Nov  RaceVSControl  Women AgeGroupYong  AgeGroupMiddle  if PreviousDonor==1&EthnicMinorities==1,robust
outreg2 using TableA5.doc, append ctitle(2) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, Minorities, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 4
reg PostTreatmentDonationbyW1Nov  RaceVSControl  Women AgeGroupYong  AgeGroupMiddle  if PreviousDonor==1&EthnicMinorities==0,robust
outreg2 using TableA5.doc, append ctitle(2) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, White, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 5
reg PostTreatmentDonationbyXmas  PartisanVSControl Women AgeGroupYong  AgeGroupYong AgeGroupMiddle if PreviousDonor==1&PARTY!="NPA"&EthnicMinorities==1,robust
outreg2 using TableA5.doc, append ctitle(1) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, Minorities, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 6
reg PostTreatmentDonationbyXmas  PartisanVSControl  Women AgeGroupYong  AgeGroupMiddle  if PreviousDonor==1&EthnicMinorities==0&PARTY!="NPA",robust
outreg2 using TableA5.doc, append ctitle(2) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, White, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 7
reg PostTreatmentDonationbyXmas  RaceVSControl Women AgeGroupYong  AgeGroupMiddle  if PreviousDonor==1&EthnicMinorities==1,robust
outreg2 using TableA5.doc, append ctitle(2) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, Minorities, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
//Column 8
reg PostTreatmentDonationbyXmas  RaceVSControl  Women AgeGroupYong  AgeGroupMiddle  if PreviousDonor==1&EthnicMinorities==0,robust
outreg2 using TableA5.doc, append ctitle(2) dec(3) addstat(Log-Likelihood Full Model, e(ll), Pseudo R2, e(r2_p)) alpha(.02, .10, .20) adec(3) rdec(3) pdec(3) addtext(Composition, White, Previous Donors, YES, Controls, YES, Weeks, Three) nonotes addnote(one-sided tests, *p<.10; **p<.05; ***p<.01)
restore




////////////////////////////////////////////////////////////////////////////////
/////////////                   Appendix B3 Results                /////////////
////////////////////////////////////////////////////////////////////////////////
preserve
///Partisan VS Control at the aggregate level
clear
drop _all
set obs 101
gen alpha=0.05
gen zalpha=1.645
gen beta=mod(_n-1,100)/100
gen Power=1-beta
gen zbetaAuto=invttail(9999,beta)
gen n1=27
gen n2=26
gen s1=.1924501
gen s2=.4851645
gen sp=sqrt(((n1-1)*s1^2+(n2-1)*s2^2)/(n1+n2-2))
gen d=sqrt((2*sp^2*(zalpha+zbetaAuto)^2)/((n1+n2)/2))
gen dobs=0.346-0.037
tw (line Power d if Power>=0.2,name(AggregatePartisan,replace) lcolor(black) lwidth(0.2) xaxis(1 2) yaxis(1 2)), xlabel(,nogrid)/*
*/ylabel(,nogrid) ylabel("",axis(2)) xlabel(0.1 (0.05) 0.4,axis(1)) xlabel("",axis(2)) xtitle("Possible Effect Size") xtitle("",axis(2)) ytitle("",axis(2)) xtitle("",axis(2))/* 
*/text(0.55 0.18 "DV=Donation",place(r) size(4) color(gs10))/*
*/text(0.45 0.18 "N=53",place(r) size(4) color(gs10))/*
*/text(0.25 0.18 "1-{&beta}=0.92",place(r) size(4) color(gs10))/*
*/text(0.35 0.18 "{&alpha}=0.05",place(r) size(4) color(gs10)) xline(0.309,lcolor(gs12) lwidth(0.2))  /*  yline(0.923,lcolor(gs12)lwidth(0.2))
*/title("Aggregate Partisan Treatment Effect",color(black))graphregion(color(white)) plotregion(color(white)) 

clear
set obs 101
gen alpha=0.05
gen zalpha=1.645
gen beta=mod(_n-1,100)/100
gen Power=1-beta
gen zbetaAuto=invttail(9999,beta)
gen n1=10
gen n2=9
gen s1=0
gen s2=0.5
gen sp=sqrt(((n1-1)*s1^2+(n2-1)*s2^2)/(n1+n2-2))
gen d=sqrt((2*sp^2*(zalpha+zbetaAuto)^2)/((n1+n2)/2))
gen dobs=0.333
tw (line Power d if Power>=0.2,name(MinoritiesPartisan,replace) lcolor(black) lwidth(0.2) xaxis(1 2) yaxis(1 2)), xlabel(,nogrid)/*
*/ylabel(,nogrid) ylabel("",axis(2)) xlabel(0.1 (0.1) 0.6,axis(1)) xlabel("",axis(2)) xtitle("Possible Effect Size") xtitle("",axis(2)) ytitle("",axis(2)) xtitle("",axis(2))/* 
*/text(0.6 0.4 "DV=Donation",place(r) size(4) color(gs10))/*
*/text(0.5 0.4 "N=19",place(r) size(4) color(gs10))/*
*/text(0.3 0.4 "1-{&beta}=0.68",place(r) size(4) color(gs10))/*
*/text(0.4 0.4 "{&alpha}=0.05",place(r) size(4) color(gs10)) xline(0.333,lcolor(gs12) lwidth(0.2))  /*  yline(0.68,lcolor(gs12)lwidth(0.2))
*/title("Partisan Treatment Effect on Minorities",color(black))graphregion(color(white)) plotregion(color(white)) 

clear
set obs 101
gen alpha=0.05
gen zalpha=1.645
gen beta=mod(_n-1,100)/100
gen Power=1-beta
gen zbetaAuto=invttail(9999,beta)
gen n1=17
gen n2=17
gen s1=.2425356
gen s2=.4925922
gen sp=sqrt(((n1-1)*s1^2+(n2-1)*s2^2)/(n1+n2-2))
gen d=sqrt((2*sp^2*(zalpha+zbetaAuto)^2)/((n1+n2)/2))
gen dobs=0.294
tw (line Power d if Power>=0.2,name(WhitePartisan,replace) lcolor(black) lwidth(0.2) xaxis(1 2) yaxis(1 2)), xlabel(,nogrid)/*
*/ylabel(,nogrid) ylabel("",axis(2)) xlabel(0.1 (0.1) 0.5,axis(1)) xlabel("",axis(2)) xtitle("Possible Effect Size") xtitle("",axis(2)) ytitle("",axis(2)) xtitle("",axis(2))/* 
*/text(0.6 0.35 "DV=Donation",place(r) size(4) color(gs10))/*
*/text(0.5 0.35 "N=34",place(r) size(4) color(gs10))/*
*/text(0.3 0.35 "1-{&beta}=0.71",place(r) size(4) color(gs10))/*
*/text(0.4 0.35 "{&alpha}=0.05",place(r) size(4) color(gs10)) xline(0.294,lcolor(gs12) lwidth(0.2))  /*  yline(0.713,lcolor(gs12)lwidth(0.2))
*/title("Partisan Treatment Effect on White",color(black))graphregion(color(white)) plotregion(color(white)) 


///Race VS Control for minorities
clear
drop _all
set obs 101
gen alpha=0.05
gen zalpha=1.645
gen beta=mod(_n-1,100)/100
gen Power=1-beta
gen zbetaAuto=invttail(9999,beta)
gen n1=13
gen n2=8
gen s1=.5175492
gen s2=0
gen sp=sqrt(((n1-1)*s1^2+(n2-1)*s2^2)/(n1+n2-2))
gen d=sqrt((2*sp^2*(zalpha+zbetaAuto)^2)/((n1+n2)/2))
gen dobs=0.25-0
tw (line Power d if Power>=0.2,name(RacialMinorities,replace) lcolor(black) lwidth(0.2) xaxis(1 2) yaxis(1 2)), xlabel(,nogrid)/*
*/ylabel(,nogrid) ylabel("",axis(2)) xlabel(0.1 (0.1) 0.7,axis(1)) xlabel("",axis(2)) xtitle("Possible Effect Size") xtitle("",axis(2)) ytitle("",axis(2)) xtitle("",axis(2))/* 
*/text(0.65 0.4 "DV=Donation",place(r) size(4) color(gs10))/*
*/text(0.55 0.4 "N=21",place(r) size(4) color(gs10))/*
*/text(0.35 0.4 "1-{&beta}=0.67",place(r) size(4) color(gs10))/*
*/text(0.45 0.4 "{&alpha}=0.05",place(r) size(4) color(gs10)) xline(0.375,lcolor(gs12) lwidth(0.2))  /*  yline(0.673,lcolor(gs12)lwidth(0.2))
*/title("Racial Treatment Effect on Minorities",color(black))graphregion(color(white)) plotregion(color(white)) 

graph combine AggregatePartisan MinoritiesPartisan WhitePartisan RacialMinorities, name(SimulatedPowerAnalysis,replace) graphregion(color(white)) plotregion(color(white)) row(2) 
restore

log close